<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Editar Juíz</h2>
            <h:form id="form" acceptcharset="utf-8">
                <p:growl id="msg" life="3000"/>
                <p:panel styleClass="container_24 clearfix " style="background: none; border: none;">
                    <p class="subtitle">Dados do Juíz</p>

                    <p:outputLabel value="Nome :" styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.executor.name}" styleClass="grid_21"/>
                    <p:outputLabel value="Oab :" styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.executor.oab}"  styleClass="grid_21"/>
                    <p:outputLabel value="Email :" styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.executor.email}"  styleClass="grid_21"/>
                    <p:outputLabel for="organ" value="Orgão :" styleClass="grid_2"/>
                    <div class="grid_9">
                        <p:autoComplete  value="#{managerEditExecutor.organ}" completeMethod="#{managerCreateOrgan.autocomplete}"   
                                         var="organ" id="organ" 
                                         itemLabel="#{organ.name}" itemValue="#{organ}" converter="organConverter" 
                                         forceSelection="true" converterMessage="Erro, verifique a cidade" minQueryLength="3" 
                                         maxResults="10" dropdown="true"> 
                        </p:autoComplete>
                    </div>
                    <div class="clear"/>
                    <p:outputLabel value="Função :" styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.executor.function}"  styleClass="grid_21"/>

                    <div class="clear"/>
                    <p class="subtitle">Dados do Endereço</p>

                    <p:outputLabel value="Rua :"  styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.address.street}"  styleClass="grid_21"/>
                    <p:outputLabel value="Bairro :"  styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.address.district}" styleClass="grid_21"/>
                    <p:outputLabel value="Num :"  styleClass="grid_2"/>
                    <p:inputText value="#{managerEditExecutor.address.num}" styleClass="grid_21"/>
                    <p:outputLabel value="Cep :"  styleClass="grid_2"/>
                    <p:inputMask mask="99.999-999" value="#{managerEditExecutor.address.cep}" styleClass="grid_21"/>

                    <p:outputLabel  value=" Cidade:"  styleClass="grid_2" />
                    <div class="grid_10">
                    <p:autoComplete id="cidadeEstado" value="#{managerEditExecutor.address.city}" completeMethod="#{managerCreateAddress.completeCity}"   
                                    var="city"  required="true" requiredMessage="o campo cidade deve ser preenchido"
                                    itemLabel="#{city.name} #{city.states.sgl}" itemValue="#{city}" converter="cityConverter" forceSelection="true" converterMessage="Erro, verifique a cidade" minQueryLength="3" maxResults="10" dropdown="true"> 
                    </p:autoComplete>
                    </div>
                    <div class="clear"/>
                    <p:outputLabel value="Tel :" styleClass="grid_2"/>
                    <p:inputMask mask="99-9999-9999" value="#{managerEditExecutor.address.phone}" styleClass="grid_5"/>
                    <p:outputLabel value="Cel :" styleClass="grid_2"/>
                    <p:inputMask mask="99-9999-9999"  value="#{managerEditExecutor.address.cellular}" styleClass="grid_5"/>


                    <br/> 
                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Atualizar" icon="ui-icon-document"  styleClass="ui-priority-primary"
                                         actionListener="#{managerEditExecutor.update()}" update="msg, @form"/>
                        <p:commandButton value="Cancelar" icon="ui-icon-close"
                                         actionListener="#{managerRedirect.redirect('viewExecutor.xhtml')}" immediate="true"/>

                    </div>
                </p:panel> 
            </h:form>
        </ui:define>
    </ui:composition>
</html>


